package com.fly.springbootTemplate.controller;

import com.fly.springbootTemplate.entity.StudentCourse;
import com.fly.springbootTemplate.service.StudentCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/course")
public class StudentCourseController {
    @Autowired
    private StudentCourseService studentCourseService;
    @RequestMapping("/addCourse")
    public boolean addCourse(StudentCourse studentCourse) {
        return studentCourseService.addCourse(studentCourse);
    }
    @RequestMapping("/deleteCourse")
    public boolean deleteCourse(String courseId) {
        return studentCourseService.deleteCourse(courseId);
    }
    @RequestMapping("/updateCourse")
    public boolean updateCourse(StudentCourse studentCourse) {
        return studentCourseService.updateCourse(studentCourse);
    }
    @RequestMapping("/getAllCourse")
    public List<StudentCourse> getAllCourse() {
        return studentCourseService.getAllCourse();
    }
    @RequestMapping("/getCourseById")
    public StudentCourse getCourseById(String courseId) {
        return studentCourseService.getCourseById(courseId);
    }
}
